Check that xenstored has actually started before talking to it.
authorIan Campbell <ijc@debian.org>
Tue, 25 Nov 2014 12:47:08 +0000 (12:47 +0000)
committerIan Jackson <Ian.Jackson@eu.citrix.com>
Mon, 23 Jan 2017 16:23:58 +0000 (16:23 +0000)
Incorporate a timeout so as not to block boot (Mitigates #737613).

This code was taken from the upstream initscript and adapted, so it is
pretty well tested.

(cherry picked from commit 57e0a490c53a029d0921edde9e1acdc158ac2164)

Conflicts:
debian/changelog
debian/xen-utils-common.xen.init

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
debian/changelog
debian/xen-utils-common.xen.init

index cc1d4029404ce54f12030ada38e26712720889c7..80e1e6ff7d6f7d07fe45e74d24bb651be9dacb72 100644 (file)
@@ -33,6 +33,8 @@ xen (4.8.0-1~) unstable; urgency=high
   * Start a qemu process in dom0 to service the toolstacks loopback disk
     attaches. (Closes: #770456)
   * Remove correct pidfile when stopping xenconsoled.
+  * Check that xenstored has actually started before talking to it.
+    Incorporate a timeout so as not to block boot (Mitigates #737613)
 
   [ Lubomir Host ]
   * Fix xen-init-name to not fail looking for a nonexistent 'config'
index 252ddc0e440ea674cdf46fd4b1442ac9b0892d3b..1342a7d5d529833c49ed2f64cdfd9184fed60609 100644 (file)
@@ -251,6 +251,19 @@ xenstored_start()
        start-stop-daemon --start --quiet --pidfile "$XENSTORED_PIDFILE" --exec "$XENSTORED" -- \
                $XENSTORED_ARGS --pid-file="$XENSTORED_PIDFILE" \
                || return 2
+
+       # Wait for xenstored to actually come up, timing out after 30 seconds
+       local time=0
+       local timeout=30
+       while [ $time -lt $timeout ] && ! `/usr/sbin/xenstore-read -s / >/dev/null 2>&1` ; do
+           time=$(( $time+1 ))
+           sleep 1
+       done
+
+       # Exit if we timed out
+       if ! [ $time -lt $timeout ] ; then
+           return 2
+       fi
 }
 
 init_dom0()